//
//  UploadFourthViewController.m
//  LoveAttention
//
//  Created by 于金祥 on 16/6/3.
//  Copyright © 2016年 JC. All rights reserved.
//

#import "UploadFourthViewController.h"
#import "CommonDef.h"
#import "VPImageCropperViewController.h"
#import <MobileCoreServices/MobileCoreServices.h>
#import "DataProvider.h"
#import "SVProgressHUD.h"

#define ORIGINAL_MAX_WIDTH 640.0f

@interface UploadFourthViewController ()<UIGestureRecognizerDelegate,UIImagePickerControllerDelegate, UINavigationControllerDelegate,UIActionSheetDelegate,VPImageCropperDelegate>

@end

@implementation UploadFourthViewController
{
    UITextField * txt_farenName;//法人姓名
    UITextField * txt_farenIDCard;//法人身份证
    UITextField * txt_yingyezhidao;//营业执照名称
    
    UIImageView * img_Header;//身份证正面
    BOOL headerselected;
    UIImageView * img_Header1;//身份证反面
    BOOL header1selected;
    UIImageView * img_Header2;//营业执照
    BOOL header2selected;
    
    NSData * data_Header;
    NSData * data_Header1;
    NSData * data_Header2;
    
    NSInteger selectbtn;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    headerselected=NO;
    header1selected=NO;
    header2selected=NO;
    selectbtn=10;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOne)];
    tapGesture.delegate = self;
    [self.view addGestureRecognizer:tapGesture];
    [self p_navigationController];
    [self BuildAllView];
}

#pragma mark - navigationController
- (void)p_navigationController
{
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    self.navigationItem.title = @"提交相关认证资料";
    
    //    self.navigationItem.leftBarButtonItem
    
    
    UIButton * btn = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [btn setBackgroundImage:[UIImage imageNamed:@"返回"] forState:(UIControlStateNormal)];
    btn.frame = CGRectMake(10, 20, 25, 30);
    [btn addTarget:self action:@selector(leftBarButtonItemAction:) forControlEvents:(UIControlEventTouchUpInside)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    
    //    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"注册" style:(UIBarButtonItemStyleDone) target:self action:@selector(rightBarButtonItemAction:)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor];
    //    self.navigationItem.rightBarButtonItem.tintColor = [UIColor whiteColor];
}
//点击事件(左)
- (void)leftBarButtonItemAction:(UIBarButtonItem *)bar
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)tapOne{
    [txt_farenName resignFirstResponder];
    [txt_farenIDCard resignFirstResponder];
    [txt_yingyezhidao resignFirstResponder];
//    [txt_shopDetial resignFirstResponder];
    
    //    CGRect frame = mView.frame;
    //    if (frame.origin.y == 0) {
    //        return;
    //    }
    //    frame.origin.y += frame.size.height * 0.2;
    //    [UIView beginAnimations:@"moveView" context:nil];
    //    [UIView setAnimationDuration:0.3];
    //    mView.frame = frame;
    //    [UIView commitAnimations];
}


-(void)BuildAllView
{
    txt_farenName=[[UITextField alloc] initWithFrame:CGRectMake(0, 74, SCREEN_WIDTH, 44)];
    txt_farenName.backgroundColor=[UIColor whiteColor];
    txt_farenName.font=[UIFont systemFontOfSize:14];
    txt_farenName.placeholder=@"法人真实姓名";
    UILabel * lbl_Nameleft=[[UILabel alloc] initWithFrame:CGRectMake(10, 12, 100, 20)];
    lbl_Nameleft.text=@"法人姓名:";
    txt_farenName.leftView =lbl_Nameleft;
    txt_farenName.leftViewMode=UITextFieldViewModeAlways;
    [self.view addSubview:txt_farenName];
    
    txt_farenIDCard=[[UITextField alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(txt_farenName.frame)+1, SCREEN_WIDTH, 44)];
    txt_farenIDCard.backgroundColor=[UIColor whiteColor];
    txt_farenIDCard.font=[UIFont systemFontOfSize:14];
    txt_farenIDCard.placeholder=@"填写身份证";
    UILabel * lbl_IDCardleft=[[UILabel alloc] initWithFrame:CGRectMake(10, 12, 100, 20)];
    lbl_IDCardleft.text=@"法人身份证:";
    txt_farenIDCard.leftView =lbl_IDCardleft;
    txt_farenIDCard.leftViewMode=UITextFieldViewModeAlways;
    [self.view addSubview:txt_farenIDCard];
    
    txt_yingyezhidao=[[UITextField alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(txt_farenIDCard.frame)+1, SCREEN_WIDTH, 44)];
    txt_yingyezhidao.backgroundColor=[UIColor whiteColor];
    txt_yingyezhidao.font=[UIFont systemFontOfSize:14];
    txt_yingyezhidao.placeholder=@"填写营业执照名称";
    UILabel * lbl_zhizhaoleft=[[UILabel alloc] initWithFrame:CGRectMake(10, 12, 100, 20)];
    lbl_zhizhaoleft.text=@"营业执照名称:";
    txt_yingyezhidao.leftView =lbl_zhizhaoleft;
    txt_yingyezhidao.leftViewMode=UITextFieldViewModeAlways;
    [self.view addSubview:txt_yingyezhidao];
    
    CGFloat itemwith=(SCREEN_WIDTH-210)/4;
    
    UIView * imgBackView=[[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(txt_yingyezhidao.frame)+1, SCREEN_WIDTH, 110)];
    imgBackView.backgroundColor=[UIColor whiteColor];
    img_Header=[[UIImageView alloc] initWithFrame:CGRectMake(0,0, 70, 70)];
    img_Header.image=[UIImage imageNamed:@"addBtn"];
    UILabel * lbl_tishi=[[UILabel alloc] initWithFrame:CGRectMake(img_Header.frame.origin.x, CGRectGetMaxY(img_Header.frame), img_Header.frame.size.width, 20)];
    lbl_tishi.font=[UIFont systemFontOfSize:13];
    lbl_tishi.text=@"身份证正面";
    lbl_tishi.textAlignment=NSTextAlignmentCenter;
    lbl_tishi.textColor=[UIColor grayColor];
    UIButton * btn_header=[[UIButton alloc] initWithFrame:CGRectMake(itemwith, 10, 70, 90)];
    [btn_header addSubview:img_Header];
    [btn_header addSubview:lbl_tishi];
    btn_header.tag=0;
    [btn_header addTarget:self action:@selector(Uploadview:) forControlEvents:UIControlEventTouchUpInside];
    [imgBackView addSubview:btn_header];
    
    img_Header1=[[UIImageView alloc] initWithFrame:CGRectMake(0,0, 70, 70)];
    img_Header1.image=[UIImage imageNamed:@"addBtn"];
    UILabel * lbl_tishi1=[[UILabel alloc] initWithFrame:CGRectMake(img_Header1.frame.origin.x, CGRectGetMaxY(img_Header.frame), img_Header.frame.size.width, 20)];
    lbl_tishi1.font=[UIFont systemFontOfSize:13];
    lbl_tishi1.text=@"身份证反面";
    lbl_tishi1.textAlignment=NSTextAlignmentCenter;
    lbl_tishi1.textColor=[UIColor grayColor];
    UIButton * btn_header1=[[UIButton alloc] initWithFrame:CGRectMake(itemwith+CGRectGetMaxX(btn_header.frame), 10, 70, 90)];
    [btn_header1 addSubview:img_Header1];
    [btn_header1 addSubview:lbl_tishi1];
    btn_header1.tag=1;
    [btn_header1 addTarget:self action:@selector(Uploadview:) forControlEvents:UIControlEventTouchUpInside];
    [imgBackView addSubview:btn_header1];
    
    img_Header2=[[UIImageView alloc] initWithFrame:CGRectMake(0,0, 70, 70)];
    img_Header2.image=[UIImage imageNamed:@"addBtn"];
    UILabel * lbl_tishi2=[[UILabel alloc] initWithFrame:CGRectMake(img_Header2.frame.origin.x, CGRectGetMaxY(img_Header.frame), img_Header.frame.size.width, 20)];
    lbl_tishi2.font=[UIFont systemFontOfSize:13];
    lbl_tishi2.text=@"营业执照";
    lbl_tishi2.textAlignment=NSTextAlignmentCenter;
    lbl_tishi2.textColor=[UIColor grayColor];
    UIButton * btn_header2=[[UIButton alloc] initWithFrame:CGRectMake(itemwith+CGRectGetMaxX(btn_header1.frame), 10, 70, 90)];
    [btn_header2 addSubview:img_Header2];
    [btn_header2 addSubview:lbl_tishi2];
    [btn_header2 addTarget:self action:@selector(Uploadview:) forControlEvents:UIControlEventTouchUpInside];
    btn_header2.tag=2;
    [imgBackView addSubview:btn_header2];
    [self.view addSubview:imgBackView];
    
    UILabel * lbl_phototishi=[[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(imgBackView.frame)+1, SCREEN_WIDTH, 20)];
    lbl_phototishi.font=[UIFont systemFontOfSize:15];
    lbl_phototishi.textAlignment=NSTextAlignmentCenter;
    lbl_phototishi.textColor=[UIColor grayColor];
    lbl_phototishi.text=@"所传照片必须为真实，且可以清晰看到内容";
//    lbl_phototishi.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:lbl_phototishi];
    
    
    UIButton * btn_next=[[UIButton alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(lbl_phototishi.frame)+30, SCREEN_WIDTH-30, 30)];
    btn_next.layer.masksToBounds=YES;
    btn_next.layer.cornerRadius=5;
    btn_next.backgroundColor=[UIColor orangeColor];
    [btn_next setTitle:@"提交" forState:UIControlStateNormal];
    [btn_next addTarget:self action:@selector(NextStep) forControlEvents:UIControlEventTouchUpInside];
    [btn_next setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.view addSubview:btn_next];
}

-(void)NextStep
{
    @try {
        if (headerselected&&header1selected&&header2selected) {
            if (txt_yingyezhidao.text.length>0&&txt_farenIDCard.text.length>0&&txt_farenIDCard.text.length<=18&&txt_farenName.text.length>0) {
                [SVProgressHUD showWithStatus:@"正在提交信息。。" maskType:SVProgressHUDMaskTypeBlack];
                NSMutableDictionary * prm=[[NSMutableDictionary alloc] init];
                [prm setObject:get_sp(@"memberid") forKey:@"memberid"];
                [prm setObject:_secondid forKey:@"cateid"];
                [prm setObject:_shopname forKey:@"name"];
                [prm setObject:_shopTel forKey:@"telephone"];
                [prm setObject:_shopaddress forKey:@"address"];
                [prm setObject:_shopDetial forKey:@"remark"];
                [prm setObject:txt_farenName.text forKey:@"farenname"];
                [prm setObject:txt_farenIDCard.text forKey:@"cardnum"];
                [prm setObject:txt_yingyezhidao.text forKey:@"yyzzname"];
//                [prm setObject:self.img_showHeader forKey:@"avatar"];
//                [prm setObject:data_Header forKey:@"cardz"];
//                [prm setObject:data_Header1 forKey:@"cardf"];
//                [prm setObject:data_Header2 forKey:@"yyzz"];
                DataProvider * dataprovider=[[DataProvider alloc] init];
                [dataprovider setDelegateObject:self setBackFunctionName:@"UploadShopInfoCallBack:"];
                [dataprovider UploadShopInfoWithprm:prm andavatar:self.img_showHeader andcardz:data_Header andcardf:data_Header1 andyyzz:data_Header2];
            }
        }
        else
        {
            UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"请确保您的提交的信息完整并正确" preferredStyle:(UIAlertControllerStyleAlert)];
            
            [self presentViewController:alert animated:YES completion:^{
                
            }];
            
            UIAlertAction * action = [UIAlertAction actionWithTitle:@"知道了" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
                
            }];
            
            [alert addAction:action];
        }
    } @catch (NSException *exception) {
        [SVProgressHUD dismiss];
    } @finally {
        
    }
    
   
}

-(void)UploadShopInfoCallBack:(id)dict
{
    [SVProgressHUD dismiss];
    NSLog(@"%@",dict);
    if ([dict[@"status"][@"succeed"] intValue ]==1) {
        [SVProgressHUD showSuccessWithStatus:@"资料保存成功,请等待。。"];
        set_sp(@"errcode", @"2222");
        set_sp(@"errdesc", dict[@"status"][@"errdesc"]);
        [[NSNotificationCenter defaultCenter] postNotificationName:@"UpoladInfoSuccess" object:nil];
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
}
-(void)Uploadview:(UIButton *)sender
{
    [self editPortrait];
    selectbtn=sender.tag;
}

/********************************上传图片开始*************************************/


- (void)editPortrait {
    UIActionSheet *choiceSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                             delegate:self
                                                    cancelButtonTitle:@"取消"
                                               destructiveButtonTitle:nil
                                                    otherButtonTitles:@"拍照", @"从相册中选取", nil];
    [choiceSheet showInView:self.view];
}

#pragma mark VPImageCropperDelegate
- (void)imageCropper:(VPImageCropperViewController *)cropperViewController didFinished:(UIImage *)editedImage {
//    img_Header.image = editedImage;
    switch (selectbtn) {
        case 0:
            img_Header.image=editedImage;
            headerselected=YES;
            data_Header=[NSData dataWithData:UIImagePNGRepresentation(editedImage)];
            break;
        case 1:
            img_Header1.image=editedImage;
            header1selected=YES;
            data_Header1=[NSData dataWithData:UIImagePNGRepresentation(editedImage)];
            break;
        case 2:
            img_Header2.image=editedImage;
            header2selected=YES;
            data_Header2=[NSData dataWithData:UIImagePNGRepresentation(editedImage)];
            break;
        default:
            break;
    }

    [cropperViewController dismissViewControllerAnimated:YES completion:^{
        // TO DO
        
                [self saveImage:editedImage withName:@"avatar.jpg"];
        
        
        NSData *imageData = UIImagePNGRepresentation(editedImage);
        
        
    }];
}

#pragma mark - 保存图片至沙盒
- (void) saveImage:(UIImage *)currentImage withName:(NSString *)imageName
{
    NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
    // 获取沙盒目录
    NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
    // 将图片写入文件
    [imageData writeToFile:fullPath atomically:NO];
}

- (void)imageCropperDidCancel:(VPImageCropperViewController *)cropperViewController {
    [cropperViewController dismissViewControllerAnimated:YES completion:^{
    }];
}

#pragma mark UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
        // 拍照
        if ([self isCameraAvailable] && [self doesCameraSupportTakingPhotos]) {
            UIImagePickerController *controller = [[UIImagePickerController alloc] init];
            controller.sourceType = UIImagePickerControllerSourceTypeCamera;
            if ([self isFrontCameraAvailable]) {
                controller.cameraDevice = UIImagePickerControllerCameraDeviceFront;
            }
            NSMutableArray *mediaTypes = [[NSMutableArray alloc] init];
            [mediaTypes addObject:(__bridge NSString *)kUTTypeImage];
            controller.mediaTypes = mediaTypes;
            controller.delegate = self;
            [self presentViewController:controller
                               animated:YES
                             completion:^(void){
                                 NSLog(@"Picker View Controller is presented");
                             }];
        }
        
    } else if (buttonIndex == 1) {
        // 从相册中选取
        if ([self isPhotoLibraryAvailable]) {
            UIImagePickerController *controller = [[UIImagePickerController alloc] init];
            controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            NSMutableArray *mediaTypes = [[NSMutableArray alloc] init];
            [mediaTypes addObject:(__bridge NSString *)kUTTypeImage];
            controller.mediaTypes = mediaTypes;
            controller.delegate = self;
            [self presentViewController:controller
                               animated:YES
                             completion:^(void){
                                 NSLog(@"Picker View Controller is presented");
                             }];
        }
    }
}

#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissViewControllerAnimated:YES completion:^() {
        UIImage *portraitImg = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
        portraitImg = [self imageByScalingToMaxSize:portraitImg];
        // 裁剪
        VPImageCropperViewController *imgEditorVC = [[VPImageCropperViewController alloc] initWithImage:portraitImg cropFrame:CGRectMake(0, 100.0f, self.view.frame.size.width, self.view.frame.size.width) limitScaleRatio:3.0];
        imgEditorVC.delegate = self;
        [self presentViewController:imgEditorVC animated:YES completion:^{
            // TO DO
        }];
    }];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    [picker dismissViewControllerAnimated:YES completion:^(){
    }];
}

#pragma mark - UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
}

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
}

#pragma mark camera utility
- (BOOL) isCameraAvailable{
    return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
}

- (BOOL) isRearCameraAvailable{
    return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear];
}

- (BOOL) isFrontCameraAvailable {
    return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront];
}

- (BOOL) doesCameraSupportTakingPhotos {
    return [self cameraSupportsMedia:(__bridge NSString *)kUTTypeImage sourceType:UIImagePickerControllerSourceTypeCamera];
}

- (BOOL) isPhotoLibraryAvailable{
    return [UIImagePickerController isSourceTypeAvailable:
            UIImagePickerControllerSourceTypePhotoLibrary];
}
- (BOOL) canUserPickVideosFromPhotoLibrary{
    return [self
            cameraSupportsMedia:(__bridge NSString *)kUTTypeMovie sourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
- (BOOL) canUserPickPhotosFromPhotoLibrary{
    return [self
            cameraSupportsMedia:(__bridge NSString *)kUTTypeImage sourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}

- (BOOL) cameraSupportsMedia:(NSString *)paramMediaType sourceType:(UIImagePickerControllerSourceType)paramSourceType{
    __block BOOL result = NO;
    if ([paramMediaType length] == 0) {
        return NO;
    }
    NSArray *availableMediaTypes = [UIImagePickerController availableMediaTypesForSourceType:paramSourceType];
    [availableMediaTypes enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL *stop) {
        NSString *mediaType = (NSString *)obj;
        if ([mediaType isEqualToString:paramMediaType]){
            result = YES;
            *stop= YES;
        }
    }];
    return result;
}
#pragma mark image scale utility
- (UIImage *)imageByScalingToMaxSize:(UIImage *)sourceImage {
    if (sourceImage.size.width < ORIGINAL_MAX_WIDTH) return sourceImage;
    CGFloat btWidth = 0.0f;
    CGFloat btHeight = 0.0f;
    if (sourceImage.size.width > sourceImage.size.height) {
        btHeight = ORIGINAL_MAX_WIDTH;
        btWidth = sourceImage.size.width * (ORIGINAL_MAX_WIDTH / sourceImage.size.height);
    } else {
        btWidth = ORIGINAL_MAX_WIDTH;
        btHeight = sourceImage.size.height * (ORIGINAL_MAX_WIDTH / sourceImage.size.width);
    }
    CGSize targetSize = CGSizeMake(btWidth, btHeight);
    return [self imageByScalingAndCroppingForSourceImage:sourceImage targetSize:targetSize];
}
- (UIImage *)imageByScalingAndCroppingForSourceImage:(UIImage *)sourceImage targetSize:(CGSize)targetSize {
    UIImage *newImage = nil;
    CGSize imageSize = sourceImage.size;
    CGFloat width = imageSize.width;
    CGFloat height = imageSize.height;
    CGFloat targetWidth = targetSize.width;
    CGFloat targetHeight = targetSize.height;
    CGFloat scaleFactor = 0.0;
    CGFloat scaledWidth = targetWidth;
    CGFloat scaledHeight = targetHeight;
    CGPoint thumbnailPoint = CGPointMake(0.0,0.0);
    if (CGSizeEqualToSize(imageSize, targetSize) == NO)
    {
        CGFloat widthFactor = targetWidth / width;
        CGFloat heightFactor = targetHeight / height;
        
        if (widthFactor > heightFactor)
            scaleFactor = widthFactor; // scale to fit height
        else
            scaleFactor = heightFactor; // scale to fit width
        scaledWidth  = width * scaleFactor;
        scaledHeight = height * scaleFactor;
        
        // center the image
        if (widthFactor > heightFactor)
        {
            thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
        }
        else
            if (widthFactor < heightFactor)
            {
                thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
            }
    }
    UIGraphicsBeginImageContext(targetSize); // this will crop
    CGRect thumbnailRect = CGRectZero;
    thumbnailRect.origin = thumbnailPoint;
    thumbnailRect.size.width  = scaledWidth;
    thumbnailRect.size.height = scaledHeight;
    
    [sourceImage drawInRect:thumbnailRect];
    
    newImage = UIGraphicsGetImageFromCurrentImageContext();
    if(newImage == nil) NSLog(@"could not scale image");
    
    //pop the context to get back to the default
    UIGraphicsEndImageContext();
    return newImage;
}
-(void)UploadBackCall:(id)dict
{
    NSLog(@"%@",dict);
    //    [img_touxiang setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",KURL,dict[@"data"][@"url"]]]]]
    //     ];
    //    [SVProgressHUD dismiss];
    //    if ([dict[@"status"][@"succeed"] intValue]==1) {
    //        //准备刷新头像
    //        [SVProgressHUD showSuccessWithStatus:@"图片上传成功" maskType:SVProgressHUDMaskTypeBlack];
    //
    //        set_sp(@"imgpath", dict[@"data"][@"imgurl"]);
    //
    //        NSString *url = [NSString stringWithFormat:@"%@upload/%@",Url,get_sp(@"imgpath")];
    //        [self.image_head sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"头像"]];
    //    }
    //    else
    //    {
    //        [SVProgressHUD showErrorWithStatus:@"上传失败，请重新上传" maskType:SVProgressHUDMaskTypeBlack];
    //    }
}

/*************************************上传图片结束******************************************/


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
